package com.ac.app.web.action.invest;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.ac.app.dm.PickInvest;
import com.ac.app.dm.PickOrg;
import com.ac.app.web.form.PickInvestForm;

import com.caac.core.util.DateUtils;
import com.caac.core.web.action.BaseAction;
import com.caac.core.web.form.BaseForm;

public class EditPickInvestAction extends BaseAction {

	
	protected ActionForward doExecute(ActionMapping mapping, BaseForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		String id=request.getParameter("id");
    	PickInvestForm myForm=(PickInvestForm)form;
    	if(id==null){
    		PickInvest dm=new PickInvest();
    		dm.setStatus(new Integer(1));
    		myForm.setDm(dm);
    	}else{
    		PickInvest dm=(PickInvest)this.getBaseManager().getObjectById(PickInvest.class, id);
    		myForm.setDm(dm);
    		myForm.setPrjBegdate(DateUtils.convertToString("yyyy-MM-dd",
					dm.getPrjBegdate()));
            myForm.setPrjEnddate(DateUtils.convertToString("yyyy-MM-dd",
                    dm.getPrjEnddate()));
    	}
    	
        return forward(mapping);
    }
	
	
	}

